/* eslint-disable @typescript-eslint/no-unused-vars */
import { join, resolve } from 'path';
import { defineConfig, UserConfig } from 'vite';
import ViteUserConfig from './configs/vite/index';

// https://vitejs.dev/config/
export default defineConfig((_config: UserConfig): UserConfig => {
	return {
		...ViteUserConfig,
		envDir: resolve('configs/environments'),
		resolve: {
			alias: {
				'@': join(__dirname, 'src'),
			},
		},
		server: {
			proxy: {
				'/api': {
					target: 'http://localhost:3000',
					changeOrigin: true,
					rewrite: (path) => path.replace(/^\/api/, ''),
				},
				'/graphql': {
					target: 'http://localhost:3000',
					changeOrigin: true,
				},
			},
		},
	};
});
